﻿using Sunny.Core.DefinedData;

namespace Sunny.Core.Domain.Model
{
    public class Model<T> : BaseAggregateRootModel 
        where T : IAggregateRoot
    {
        public Model(SKey key)
            : base(key)
        {
            if (!this.IsExist)
            {
                throw new System.Exception("The key doesn't have a correct value.");
            }
        }

        //public T ToModel()
        //{
        //    //var repository = DomainFactory.GetInstance().GetRepositoryByModel<T>();

        //    //return (T)repository.GetByKey(this.Key);
        //    return null;
        //}

        protected override void CheckModel()
        {
            // do nonthing
        }
    }
}